﻿
function pagelist_lookrecord() {
    //观看记录
    var comguid = $("#sel_SearchCity").val();
    var projectguid = $("#sel_SearchProject").val();
    var depguid = $("#sel_Department").val();
    var name = $("#txt_Search_Name").val();
    var phone = $("#txt_Search_Phone").val();
    var type = $("#sel_type").val();
    var from = $("#sel_From").val();
    var startdate = $("#StartDate").val();
    var enddate = $("#EndDate").val();
    var PageIndex = document.getElementById("hid_pageindex").value;


    var tmp = arguments.callee.toString();
    var re = /function\s*(\w*)/i;
    var matches = re.exec(tmp);//获取当前方法名
    var functionname = matches[1];

    var rowcount;
    var htmlstr = "";
    document.getElementById("dataloadtishi").innerText = "数据加载中,请稍候...";
    document.getElementById("pagelist").innerHTML = htmlstr;
    $.get("/Mager_LookRecord/showpagelist", { PageIndex: PageIndex, comguid: comguid, projectguid: projectguid, depguid: depguid, name: name, phone: phone, type: type, from: from, startdate: startdate, enddate: enddate }, function (result) {
        var pagedata = JSON.parse(result.data.Content);

        htmlstr = "";
        if (pagedata != null && pagedata.length > 0) {
            for (var i = 0; i < pagedata.length; i++) {

                rowcount = i + 1;
                htmlstr = htmlstr + "<tr " + (rowcount % 2 == 0 ? "style = 'background-color:#EFF6FA'; " : "") + " onclick =\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" id =\"tr_" + rowcount + "\" >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + (rowcount + (result.data.PageIndex - 1) * result.data.PageSize) + "</td>";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].VLE_Emp_Name + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].VLE_Emp_Mobile + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].VLE_Com_Name + " -" + pagedata[i].VLE_Project_Name + " -" + pagedata[i].VLE_Dep_Name + "</td >";
                if (pagedata[i].state == "停止观看") {
                    htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\"  style='color:#808080'>" + pagedata[i].state + "</td >";
                }
                else {
                    if (pagedata[i].online == 1) {
                        htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\"  style='color:red'>" + pagedata[i].state + "</td >";
                    }
                    else {
                        htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].state + "</td >";
                    }
                }
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].vlfrom + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].VLE_Add_Time + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].VLE_TotalTime + "</td >";
                htmlstr = htmlstr + "</tr >";
                document.getElementById("pagelist").innerHTML = htmlstr;
            }
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true)
            document.getElementById("dataloadtishi").innerText = "";

        }
        else {
            document.getElementById("pagelist").innerHTML = htmlstr;
            document.getElementById("dataloadtishi").innerText = "加载完成，无数据";
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true)

        }
        document.getElementById("dataloadtishi").innerText = "";

    }).error(function () { document.getElementById("dataloadtishi").innerText = "数据加载失败，系统异常..."; });
}




function ShowPageList_LookRecord() {
    //观看记录
    var comguid = $("#sel_SearchCity").val();
    var projectguid = $("#sel_SearchProject").val();
    var depguid = $("#sel_Department").val();
   // var name = $("#txt_Search_Name").val();
    var role = $("#sel_SearchRole").val();
    var startdate = $("#StartDate").val();
    var enddate = $("#EndDate").val();
    var PageIndex = document.getElementById("hid_pageindex").value;

    var tmp = arguments.callee.toString();
    var re = /function\s*(\w*)/i;
    var matches = re.exec(tmp);//获取当前方法名
    var functionname = matches[1];

    var rowcount;
    var htmlstr = "";
    document.getElementById("dataloadtishi").innerText = "数据加载中,请稍候...";
    document.getElementById("pagelist").innerHTML = htmlstr;
    $.get("/Mager_Report/ShowPageList_LookRecord", { PageIndex: PageIndex, comguid: comguid, projectguid: projectguid, depguid: depguid, role: role, startdate: startdate, enddate: enddate }, function (result) {
        var pagedata = JSON.parse(result.data.Content);
        debugger
        htmlstr = "";
        if (pagedata != null && pagedata.length > 0) {
            for (var i = 0; i < pagedata.length; i++) {

                rowcount = i + 1;
                htmlstr = htmlstr + "<tr " + (rowcount % 2 == 0 ? "style = 'background-color:#EFF6FA'; " : "") + " onclick =\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" id =\"tr_" + rowcount + "\" >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + (rowcount + (result.data.PageIndex - 1) * result.data.PageSize) + "</td>";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].emp_name + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].emp_mobile + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].com_name + " -" + pagedata[i].project_name + " -" + pagedata[i].dep_name + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].R_Name + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].totaltime + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].lookcount + "</td >";

                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].daycount + "</td >";
                htmlstr = htmlstr + "<td onclick=\"selectTr('" + rowcount + "','15','" + pagedata[i].VLE_Guid + "')\" >" + pagedata[i].maxlooktime + "</td >";
                htmlstr = htmlstr + "</tr >";
                document.getElementById("pagelist").innerHTML = htmlstr;
            }
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true);
            document.getElementById("dataloadtishi").innerText = "";
        }
        else {
            document.getElementById("dataloadtishi").innerText = "加载完成，无数据";
            document.getElementById("pagelist").innerHTML = htmlstr;
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true)

        }


    }).error(function () { document.getElementById("dataloadtishi").innerText = "数据加载失败，系统异常..."; });
}


function ShowPageList_GBCameraList() {
    //观看记录
    //var comguid = $("#hid_city").val();
    //var projectguid = $("#hid_project").val();
    //var line = document.getElementById("hid_line").value;
    //var linedetail = document.getElementById("hid_linedetail").value;
    //var startdate = document.getElementById("StartDate").value;
    //var enddate = document.getElementById("EndDate").value;
   

    var tmp = arguments.callee.toString();
    var re = /function\s*(\w*)/i;
    var matches = re.exec(tmp);//获取当前方法名
    var functionname = matches[1];
    var PageIndex = document.getElementById("hid_pageindex").value;
   
    var rowcount;
    var htmlstr = "";
    document.getElementById("dataloadtishi").innerText = "数据加载中,请稍候...";
    document.getElementById("pagelist").innerHTML = htmlstr;
    $.get("/Mager_GB_Camera/ShowPageList", { PageIndex: PageIndex}, function (result) {

        var pagedata = JSON.parse(result.data.Content);
        htmlstr = "";
        if (pagedata != null && pagedata.length > 0) {
            for (var i = 0; i < pagedata.length; i++) {
                rowcount = i + 1;
                htmlstr = htmlstr + "<tr " + (rowcount % 2 == 0 ? "style = 'background-color:#EFF6FA'; " : "") + " id =\"tr_" + rowcount + "\" >";
                htmlstr = htmlstr + "<td>" + (rowcount + (result.data.PageIndex - 1) * result.data.PageSize) + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_Code + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].comname + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].projectname + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_Name + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_Channelid + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_Manufacture + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_Status + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_State + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'></td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_Ssrc + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].C_AddTime + "</td>";
                htmlstr = htmlstr + "</tr >";
                document.getElementById("pagelist").innerHTML = htmlstr;
            }
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true);
            document.getElementById("dataloadtishi").innerText = "";
        }
        else {
            document.getElementById("dataloadtishi").innerText = "加载完成，无数据";
            document.getElementById("pagelist").innerHTML = htmlstr;
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true)

        }


    }).error(function () { document.getElementById("dataloadtishi").innerText = "数据加载失败，系统异常..."; });
}



function ShowPageList_GBDeviceList() {
    //观看记录
    //var comguid = $("#hid_city").val();
    //var projectguid = $("#hid_project").val();
    //var line = document.getElementById("hid_line").value;
    //var linedetail = document.getElementById("hid_linedetail").value;
    //var startdate = document.getElementById("StartDate").value;
    //var enddate = document.getElementById("EndDate").value;


    var tmp = arguments.callee.toString();
    var re = /function\s*(\w*)/i;
    var matches = re.exec(tmp);//获取当前方法名
    var functionname = matches[1];
    var PageIndex = document.getElementById("hid_pageindex").value;

    var rowcount;
    var htmlstr = "";
    document.getElementById("dataloadtishi").innerText = "数据加载中,请稍候...";
    document.getElementById("pagelist").innerHTML = htmlstr;
    $.get("/Mager_GB_Device/ShowPageList", { PageIndex: PageIndex }, function (result) {

        var pagedata = JSON.parse(result.data.Content);
        htmlstr = "";
        if (pagedata != null && pagedata.length > 0) {
            for (var i = 0; i < pagedata.length; i++) {
                rowcount = i + 1;
                htmlstr = htmlstr + "<tr " + (rowcount % 2 == 0 ? "style = 'background-color:#EFF6FA'; " : "") + " id =\"tr_" + rowcount + "\" >";
                htmlstr = htmlstr + "<td>" + (rowcount + (result.data.PageIndex - 1) * result.data.PageSize) + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_Code + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].comname + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].projectname + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_Name + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_Deviceid + "</td>";

                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_Manufacturer + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_Online + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_State + "</td>";
                htmlstr = htmlstr + "<td height='28' align='center'>" + pagedata[i].D_Add_Time + "</td>";

                htmlstr = htmlstr + "<td height='28' align='center'>配置</td>";

                htmlstr = htmlstr + "</tr >";
                document.getElementById("pagelist").innerHTML = htmlstr;
            }
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true);
            document.getElementById("dataloadtishi").innerText = "";
        }
        else {
            document.getElementById("dataloadtishi").innerText = "加载完成，无数据";
            document.getElementById("pagelist").innerHTML = htmlstr;
            showpagenum(functionname, result.data.RecordCount, result.data.PageIndex, result.data.PageCount, result.data.PageNum, true)

        }


    }).error(function () { document.getElementById("dataloadtishi").innerText = "数据加载失败，系统异常..."; });
}



function ReturnPage() {
    //编辑，删除返回，重载数据
    var funname = document.getElementById("hid_pagefunction").value;
    eval(funname + "()");//执行func_abc()函数
}